package com.icoolkj.microservices.inventory.controller;

import com.icoolkj.microservices.inventory.InventoryResponse;
import com.icoolkj.microservices.inventory.service.InventoryService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author icoolkj
 * @version 1.0
 * @description
 * @createDate 2024/11/12 13:49
 */
@RestController
@RequestMapping("/api/inventory")
@RequiredArgsConstructor
public class InventoryController {

    private final InventoryService inventoryService;

    // http://localhost:8082/api/inventory/华为Mate 60,华为Mate X5

    // http://localhost:8082/api/inventory?skuCode=华为Mate 60&skuCode=华为Mate X5
    @GetMapping
    @ResponseStatus(HttpStatus.OK)
    public List<InventoryResponse> isInStock(@RequestParam List<String> skuCode){
        return inventoryService.isInStock(skuCode);
    }
}